// 引入写好的基础路径路由
import axios from '@/utils/request'

// 用户登录接口
// export const getPostList = (categoryId, pageIndex, pageSize) => {
//     return axios({
//         url: `/post?category=${categoryId}&pageIndex=${pageIndex}&pageSize=${pageSize}`
//     })
// }

// 获取栏目的文章数据
export const getPostList = (params) => {
    return axios({
        url: `/post`,
        params
    })
}

// 获取指定id的文章的详情数据
export const getPostDetail = (id) => {
    return axios({
        url: `/post/${id}`,
    })
}

// 点赞文章
export const getPostLike = (id) => {
    return axios({
        url: `/post_like/${id}`,
    })
}

// 收藏文章
export const getPostCollect = (id) => {
    return axios({
        url: `/post_star/${id}`,
    })
}

// 文章评论列表
export const getPostComment = (id) => {
    return axios({
        url: `/post_comment/${id}`,
    })
}

// 发布评论
export const publishComment = (id, data) => {
    return axios({
        method: 'post',
        url: `/post_comment/${id}`,
        data
    })
}